package com.honglang.module.album.entity;


import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.honglang.module.user.entity.User;



@Entity
@Table( name = "album")
public class Album {

	/**
	 * @uml.property  name="id"
	 */
	private Integer id;

	/**
	 * @uml.property  name="title"
	 */
	private String title;

	/** 
	 * @uml.property name="photos"
	 * @uml.associationEnd multiplicity="(0 -1)" aggregation="shared" inverse="album:com.honglang.entity.Photo"
	 *//*
	private Collection<Photo> photos;*/

	/** 
	 * @uml.property name="author"
	 * @uml.associationEnd aggregation="shared" inverse="album:com.honglang.entity.User"
	 */
	private User author;
	
	
	
	
	private int photoNumber = 0;
	
	
	
	
	
	/**
	 * Getter of the property <tt>title</tt>
	 * @return  Returns the title.
	 * @uml.property  name="title"
	 */
	@Column
	public String getTitle() {
		return title;
	}

	/**
	 * Setter of the property <tt>title</tt>
	 * @param title  The title to set.
	 * @uml.property  name="title"
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/** 
	 * Getter of the property <tt>author</tt>
	 * @return  Returns the author.
	 * @uml.property  name="author"
	 */
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn
	public User getAuthor() {
		return author;
	}

	/** 
	 * Setter of the property <tt>author</tt>
	 * @param author  The author to set.
	 * @uml.property  name="author"
	 */
	public void setAuthor(User author) {
		this.author = author;
	}
/*
	*//** 
	 * Getter of the property <tt>photos</tt>
	 * @return  Returns the photos.
	 * @uml.property  name="photos"
	 *//*
	@OneToMany(fetch=FetchType.EAGER,cascade={CascadeType.PERSIST,CascadeType.MERGE})
	@JoinTable(
				name= "album_photo",
				joinColumns = {@JoinColumn(name ="album_id")},
				inverseJoinColumns = {@JoinColumn(name ="photo_id")}
			   )
	public Collection<Photo> getPhotos() {
		return photos;
	}

	*//** 
	 * Setter of the property <tt>photos</tt>
	 * @param photos  The photos to set.
	 * @uml.property  name="photos"
	 *//*
	public void setPhotos(Collection<Photo> photos) {
		this.photos = photos;
	}
*/
	/**
	 * Getter of the property <tt>id</tt>
	 * @return  Returns the id.
	 * @uml.property  name="id"
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return id;
	}

	/**
	 * Setter of the property <tt>id</tt>
	 * @param id  The id to set.
	 * @uml.property  name="id"
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	
	@Column(length=5)
	public int getPhotoNumber() {
		return photoNumber;
	}

	public void setPhotoNumber(int photoNumber) {
		this.photoNumber = photoNumber;
	}
	
	
	

}
